<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title></title>
	<link rel="stylesheet" type="text/css" href="../css/css_reset.css" />
	<script type="text/javascript">
	!function(a){function b(){var b=g.getBoundingClientRect().width;a.rem=(b/6.4>100?100:(b/6.4<50?50:b/6.4)),g.style.fontSize=a.rem+"px"}var g=a.document.documentElement,e;a.addEventListener("resize",function(){clearTimeout(e),e=setTimeout(b,300)},!1),a.addEventListener("pageshow",function(a){a.persisted&&(clearTimeout(e),e=setTimeout(b,300))},!1),b()}(window);
	</script>
	<style type="text/css">
		/*导航栏*/
		.nav_first{height: 40px;background-color: #555555;width: 1260px;}
		.contact{position: relative;left: 1.4rem;top: 0.1rem;}
		.contact a{color: #cccccc;padding-right: 0.45rem;}
		.list_1{position: relative;right: 1.4rem;}
		.list_1 li{float: right;padding-left: 0.35rem;}
		.list_1 li a{color: #cccccc;text-decoration: none;}
		/*nav_second*/
		.nav_second{background-color:  #cccccc;height: 40px;width: 1260px;}
		.search-goods{left: 400px;top: 48px;position: absolute;margin: 0 auto;}
		.search-input-text{border: 0 ;height: 25px;line-height: 25px;outline: none;width: 350px;float: left;}
		.search-input-button{border: 0 ;/*background: url(../src/common/search-icon.jpg);*/width: 25px;height:25px;float: left;cursor: pointer;}


		#login_welcome_area {color: #cccccc}
	</style>
</head>
<body>
	<div class="head">
		<div class="nav_first">
			<div class="contact">
				<a href="#">在线客服</a>
				<a href="#">客服电话：545921090</a>
			</div>
			<ul class="list_1">
				<div id="register_logout_area">
					<li>
						<a href="../register.html" target="_top">免费注册</a>
					</li>
				</div>
				<div id="login_welcome_area">
					<li>
					<a href="../login.html" target="_top">立即登录</a>
				</li>
			</div>
			<li>
				<a href="#">常见问题</a>
			</li>
			<li>
				<a href="../index.html" target="_top">首页</a>
			</li>
		</ul>
		</div>
		<div class="nav_second">
			<div class="search-goods">
				<input type="text" class="search-input-text" id="search_content" />
				<img src="../src/common/1.gif" id="search_submit" class="search-input-button">
			</div>
		</div>
	</div>
<script type="text/javascript" charset="utf-8" src="../js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
  var isLogin = null;
  var username = null;
  $.ajax({  
            type: "get",  
            url: "../handler/check_is_login.php",  
            dataType: "json",
            async : false,   
            success: function(msg){ 
                      isLogin = msg.isLogin;
                      username = msg.username;
                    }  
    	});
  if(isLogin){
      var welcomeData = "<li>欢迎用户" +username +"</li>";
      $("#login_welcome_area").html(welcomeData);
      var logoutHref = "<li><a href='#'>退出登录</a></li>"
      $("#register_logout_area").html(logoutHref);
  }

   $("#register_logout_area").click(function() {   
           if(isLogin){
               var url = "../handler/logout.php";  
               $.ajax({  
                   type: "get",  
                   url: url,  
                   dataType: "json",   
				   async : false,
                   success: function(msg){ 
                       var loginData = "<li><a href='../login.html' target='_top'>立即登录</a></li>" 
                       $("#login_welcome_area").html(loginData);
                       var registerData = "<li><a href='#'>免费注册</a></li>"
                       $("#register_logout_area").html(registerData);
                     }  
               });
           }else{
               location.href="../register.html";
           }  
     });

   $("#search_submit").click(function() { 
		var keyword = $("#search_content").val();
		top.location.href="../goods_category.html?keyword="+encodeURIComponent(keyword);
   })
})

 
</script>
</body>
</html>